package 第十二章_反射与内省;

import org.junit.Test;

public class Actionproxy {
    private Action target;
    public Actionproxy(){

    }
    public Actionproxy(Action target){
        this.target=target;
    }
    @Test
    public void doAction(){
        long startTime=System.currentTimeMillis();
        target.doAction();
        long endTime=System.currentTimeMillis();
        System.out.println("共耗时： "+(endTime-startTime));
    }
}

interface Action{
    public void doAction();

}

class UserAction implements  Action{
    public void doAction(){
        for(int i=0;i<100;i++){
            System.out.println("用户开始工作...");
        }
    }
}



